package com.breakfast.fun.util;

import android.content.Context;
import android.content.Intent;

import com.breakfast.fun.MainActivity;
import com.breakfast.fun.event.RefreshEvent;
import com.breakfast.fun.ui.user.help.HelpCenterActivity;
import com.breakfast.fun.ui.user.login.LoginActivity;

import org.greenrobot.eventbus.EventBus;

/**
 * 登录拦截 跳转到登陆页面
 */
public class JumpUtil {

    /**
     * 用户未登录 跳转到登录
     *
     * @param context
     */
    public static void toLogin(Context context) {
        Intent intent = new Intent();
        intent.setClass(context, LoginActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }

    public static void toHome(Context context) {
        Intent intent = new Intent();
        intent.setClass(context, MainActivity.class);
        context.startActivity(intent);
        EventBus.getDefault().post(new RefreshEvent("MainActivity"));
    }

    public static void toHelp(Context context) {
        Intent intent = new Intent(context, HelpCenterActivity.class);
        context.startActivity(intent);
    }

}
